<%@page pageEncoding="UTF-8" isELIgnored="false"%>
<%@ page import="java.io.*,java.util.*" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>list</title>
</head>
<body>
<a href="../">../</a>
<table border="0">
<tr>
  <th>ファイル名</th><th>サイズ（キロバイト）</th><th>最終更新日</th>
</tr>
<%
File objFld=new File(application.getRealPath(request.getServletPath().replaceAll("/index.jsp", "")));
File[] aryFls=objFld.listFiles();

for(int i=0;i<aryFls.length;i++){
%>
  <tr>
  <td>
  <%
  if(!aryFls[i].getName().equals("index.jsp") && !aryFls[i].getName().equals(".svn")){
	  out.print("<a href=\"" + aryFls[i].getName() + "\">" + aryFls[i].getName() + "</a>");
  }
  %>
  <%
  if(aryFls[i].isDirectory() && !aryFls[i].getName().equals(".svn")){
    out.print("* ");
  }
  %>
  </td>
  <td align="right">
  <%
  if(aryFls[i].isDirectory() && !aryFls[i].getName().equals(".svn")){
    out.print("<br />");
  }else{
	if(!aryFls[i].getName().equals("index.jsp") && !aryFls[i].getName().equals(".svn")){
	    out.print(Math.ceil(aryFls[i].length()/1024+1) + "KB");
	}
  }
  %>
  </td>
  <td>
  <%
  if(!aryFls[i].getName().equals("index.jsp") && !aryFls[i].getName().equals(".svn")){
	out.print((new Date(aryFls[i].lastModified())).toString());
  }
  %>
  </td>
  </tr>
<% } %>
</table>
</html>